//获取组织名称
$('#timelyClose_combobox').combobox({
    url: '/user/getUserOrgHrorg',
    valueField: 'pkhrorg',
    textField: 'name'
})
//表格
function queryTimelyClose(){
    $('#timelyClose_form').form('submit', {
        url: '/procurement/queryTimelyClose',
        onSubmit: function(){
            var isValid = $(this).form('validate');
            return isValid;	// 返回false终止表单提交
        },
        success: function(data){
            var data = eval('(' + data + ')');
            if (data.status==200){
                $('#timelyClose_dg').datagrid({
                    nowrap: false,
                    fitColumns:true,
                    columns:timelyClose_form_columns,
                    toolbar: [{
                        text: '导出数据',
                        iconCls: 'icon-export-excel',
                        handler: function () {
                            $('#timelyClose_dg').datagrid('toExcel', '采购订单及时关闭.xls');
                        }
                    }]
                })
                //加载数据至表格
                $('#timelyClose_dg').datagrid("loadData",data.obj);
            }else{
                $('#timelyClose_dg').datagrid({ columns:timelyClose_form_columns, fitColumns:true,toolbar:null})
                $('#timelyClose_dg').datagrid("loadData",[]);
                layer.msg(data.msg,{'icon':5})
            }

        }
    });

   var timelyClose_form_columns= [[
        {title:'采购组织',field:'采购组织',align:'center',width:130},
        {title:'供应商编码',field:'供应商编码',align:'center',width:70},
        {title:'供应商名称',field:'供应商名称',align:'left',width:130,resizable:true},
        {title:'采购订单号',field:'采购订单号',align:'center',width:120},
        {title:'采购订单日期',field:'采购订单日期',align:'center',width:90},
       {title:'计划关闭日期',field:'计划关闭日期',align:'center',width:90},
        {title:'物料编码',field:'物料编码',align:'center',width:100},
        {title:'物料名称',field:'物料名称',align:'left',width:120},
        {title:'采购订单主数量',field:'采购订单主数量',align:'center',width:100},
        {title:'采购订单数量',field:'采购订单数量',align:'center',width:100},
        {title:'采购订单状态',field:'采购订单状态',align:'center',width:100},
        {title:'采购订单税率',field:'采购订单税率',align:'center',width:100},
        {title:'入库关闭',field:'入库关闭',align:'center',width:100},
        {title:'入库实收主数量',field:'入库实收主数量',align:'center',width:90},
        {title:'入库实收数量',field:'入库实收数量',align:'center',width:100}
    ]]

}
